<template>
  <el-form ref="form" :model="form" label-width="80px">
    <el-form-item label="姓名">
      <el-input v-model="form.visName"></el-input>
    </el-form-item>
    <el-form-item label="电话">
      <el-input v-model="form.visPhone"></el-input>
    </el-form-item>
    <el-form-item label="进出类型">
      <el-radio v-model="form.visType" label="0">进</el-radio>
      <el-radio v-model="form.visType" label="1">出</el-radio>
    </el-form-item>
    <el-form-item label="健康码">
      <el-select v-model="form.visHelthCode" placeholder="请选择颜色">
        <el-option label="绿码" value="0"></el-option>
        <el-option label="黄码" value="1"></el-option>
        <el-option label="红码" value="2"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="访客地址">
      <el-input v-model="form.visAddress"></el-input>
    </el-form-item>
    <el-form-item label="体温">
      <el-input type="number" v-model="form.temperature"></el-input>
    </el-form-item>
    <el-form-item label="社区">
      <el-input v-model="form.name"></el-input>
    </el-form-item>
    <el-form-item label="楼号">
      <el-input v-model="form.house"></el-input>
    </el-form-item>
    <el-form-item label="单元号">
      <el-input v-model="form.unit"></el-input>
    </el-form-item>
    <el-form-item label="备注">
      <el-input v-model="form.visRemark"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">立即创建</el-button>
    </el-form-item>
  </el-form>

</template>

<script>
export default {
  name:'VisitorAccess',
  data() {
    return {
      form: {
        visName: '',
        visPhone: '',
        visAddress: '',
        delivery: false,
        type: [],
        visHelthCode:'',
        visType: '',
        visRemark:'',
        name:'',
        house:'',
        unit:'',
        temperature: '',
      }
    }
  },
  methods: {
    onSubmit() {
      this.request.post("/vis/addVis", this.form).then(res => {
        if (res.status == 201) {
          this.$message.success("添加成功")
          this.$router.push("/visitorInformation")
        } else {
          this.$message.error(res.msg)
        }
      })
    }
  }
}
</script>

<style scoped>
.el-input{
  width: 300px;
}

</style>
